﻿package
{
    import com.greensock.loading.*;
	import com.greensock.events.LoaderEvent;
	import com.greensock.loading.display.ContentDisplay;
    import flash.display.*;

    public class LoadBigImage extends MovieClip implements IImageConfig
    {
		
        private var _queue:LoaderMax;
		private var _images:Array;
		private var _imageListURL:String;
		private var _container:Sprite = new Sprite();
		private var _imageWidth:Number;
		private var _imageHeight:Number;
		
        public function LoadBigImage(images:Array,imageListURL:String,container:Sprite,imageWidth:Number,imageHeight:Number):void
        {
            _images = images;
			_imageListURL = imageListURL;
			_container = container;
			_imageWidth = imageWidth;
			_imageHeight = imageHeight;
			
            _queue = new LoaderMax({name:"childQueue", maxConnections:1, onChildComplete:_childCompleteHandler});
			imageConfig()
            _queue.prependURLs(_imageListURL);
            _queue.load();
            return;
        }// end function
		
		public function imageConfig():void{
			var i:int = 0;
            while (i < _images.length)
            {
				_queue.append(new ImageLoader(_images[i], {name:String(i+1),container:_container, width:_imageWidth, height:_imageHeight, bgColor:0x000000}));
                i++;
            }
		}
		
        private function _childCompleteHandler(event:LoaderEvent) : void
        {
            trace("loaded " + event.target);
            return;
        }// end function

    }
}
